{% extends "main/index.html" %}

{% block title %}
    <title>:: Sirogi - List Letter :: </title>
{% endblock %}
{% block content %}
    <div class="titulo_contenedor">
	Write Letter
    </div>
    <div class="cuerpo_contenedor">
	<form method="post" action="" >
	    

	    {% if message%}
		<p class="error">{{message}}</p>
	    {% endif %}

	    {% if letters %}
		<table>
		    <tr>
			<th>Sender</th>
			<th>Subject</th>
			<th>Read</th>
			<th>Delete</th>
		    </tr>

		    {% for letter in letters%}
		    <tr>
			<td>{{letter.Sender}}</td>
			<td>{{letter.Subject}}</td>
			<td> <a href="/letter/read/{{letter.id}}">Read</a> 
			    {%if letter.Read%}
				(RD)
			    {%else%}
				(NRD)
			    {%endif%}
			</td>
			<td> <a href="/letter/delete/{{letter.id}}">Delete</a></td>
		    </tr>
		    {% endfor %}
		</table>
	    {% else %}
		<p class="error">
		    No tiene cartas disponibles para ver.
		</p>
	    {% endif %}
	</div>
	<div class="fondo_contenedor">
	</div>
	</form>
{% endblock %}
